package com.example.youjingjing.electronicbalance.util;

import android.content.Context;
import android.widget.Toast;

/**
 * Created by youjingjing on 2017/7/13.
 */

public class MyToast {
    private static Toast toast;
    public static void show(Context context, String string) {
        if (string.trim().equals(""))
            return;
        try {
            if (toast == null) {
                toast = Toast.makeText(context, string, Toast.LENGTH_LONG);
            }
            toast.setText(string);
            //toast.setGravity(Gravity.CENTER, 0, 0);
            toast.show();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
